<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>登录</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
    <h3>Hi! </h3>
    <br>
    <ul class="nav nav-tabs justify-content-center" role="tablist">
        <li class="nav-item">
            <a class="nav-link active" data-toggle="tab" href="#login">登录</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" data-toggle="tab" href="#register">注册</a>
        </li>
    </ul>

    <div class="tab-content">
        <div id="login" class="container tab-pane active"><br>
            <form method="post" action="${pageContext.request.getContextPath()}/User">
                <div class="card" style="width: 50%;margin: 0 auto;">
                    <div class="card-header">登录 <small id="sm-info" class="text-danger"> ${info}</small></div>
                    <div class="card-body">
                        <div class="input-group mb-3">
                            <div class="input-group-prepend">
                                <span class="input-group-text">账号</span>
                            </div>
                            <input name="id" type="text" class="form-control" placeholder="账号" required="required">
                        </div>
                        <div class="input-group mb-3">
                            <div class="input-group-prepend">
                                <span class="input-group-text">密码</span>
                            </div>
                            <input name="password" type="password" class="form-control" placeholder="密码"
                                   required="required">
                        </div>
                        <input name="op" type="hidden" value="login"/>
                    </div>
                    <div class="card-footer"><input type="submit" class="btn btn-outline-primary justify-content-center"
                                                    value="登录"></div>
                </div>
            </form>
        </div>
        <div id="register" class="container tab-pane fade"><br>
            <form method="post" action="${pageContext.request.getContextPath()}/User">
                <div class="card" style="width: 50%;margin: 0 auto;">
                    <div class="card-header">注册</div>
                    <div class="card-body">
                        <div class="input-group mb-3">
                            <div class="input-group-prepend">
                                <span class="input-group-text">账号</span>
                            </div>
                            <input name="id" type="text" class="form-control" placeholder="账号" required="required">
                        </div>
                        <div class="input-group mb-3">
                            <div class="input-group-prepend">
                                <span class="input-group-text">名字</span>
                            </div>
                            <input name="name" type="text" class="form-control" placeholder="名字" required="required">
                        </div>
                        <div class="input-group mb-3">
                            <div class="input-group-prepend">
                                <span class="input-group-text">密码</span>
                            </div>
                            <input name="password" type="password" class="form-control" placeholder="密码"
                                   required="required">
                        </div>
                        <input name="op" type="hidden" value="register"/>
                    </div>
                    <div class="card-footer"><input type="submit" class="btn btn-outline-primary justify-content-center"
                                                    value="注册"></div>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        setTimeout(function () {
            $("#sm-info").text("");
        }, 3000);
    });
</script>
</body>
</html>